package com.ruoyi.recipe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recipe.mapper.RecipeBrowsingHistoryMapper;
import com.ruoyi.recipe.domain.RecipeBrowsingHistory;
import com.ruoyi.recipe.service.IRecipeBrowsingHistoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 菜品浏览历史Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-21
 */
@Service
public class RecipeBrowsingHistoryServiceImpl implements IRecipeBrowsingHistoryService 
{
    @Autowired
    private RecipeBrowsingHistoryMapper recipeBrowsingHistoryMapper;

    /**
     * 查询菜品浏览历史
     * 
     * @param historyId 菜品浏览历史主键
     * @return 菜品浏览历史
     */
    @Override
    public RecipeBrowsingHistory selectRecipeBrowsingHistoryByHistoryId(Long historyId)
    {
        return recipeBrowsingHistoryMapper.selectRecipeBrowsingHistoryByHistoryId(historyId);
    }

    /**
     * 查询菜品浏览历史列表
     * 
     * @param recipeBrowsingHistory 菜品浏览历史
     * @return 菜品浏览历史
     */
    @Override
    public List<RecipeBrowsingHistory> selectRecipeBrowsingHistoryList(RecipeBrowsingHistory recipeBrowsingHistory)
    {
        return recipeBrowsingHistoryMapper.selectRecipeBrowsingHistoryList(recipeBrowsingHistory);
    }

    /**
     * 新增菜品浏览历史
     * 
     * @param recipeBrowsingHistory 菜品浏览历史
     * @return 结果
     */
    @Override
    public int insertRecipeBrowsingHistory(RecipeBrowsingHistory recipeBrowsingHistory)
    {
        recipeBrowsingHistory.setCreateTime(DateUtils.getNowDate());
        return recipeBrowsingHistoryMapper.insertRecipeBrowsingHistory(recipeBrowsingHistory);
    }

    /**
     * 修改菜品浏览历史
     * 
     * @param recipeBrowsingHistory 菜品浏览历史
     * @return 结果
     */
    @Override
    public int updateRecipeBrowsingHistory(RecipeBrowsingHistory recipeBrowsingHistory)
    {
        recipeBrowsingHistory.setUpdateTime(DateUtils.getNowDate());
        return recipeBrowsingHistoryMapper.updateRecipeBrowsingHistory(recipeBrowsingHistory);
    }

    /**
     * 批量删除菜品浏览历史
     * 
     * @param historyIds 需要删除的菜品浏览历史主键
     * @return 结果
     */
    @Override
    public int deleteRecipeBrowsingHistoryByHistoryIds(String historyIds)
    {
        return recipeBrowsingHistoryMapper.deleteRecipeBrowsingHistoryByHistoryIds(Convert.toStrArray(historyIds));
    }

    /**
     * 删除菜品浏览历史信息
     * 
     * @param historyId 菜品浏览历史主键
     * @return 结果
     */
    @Override
    public int deleteRecipeBrowsingHistoryByHistoryId(Long historyId)
    {
        return recipeBrowsingHistoryMapper.deleteRecipeBrowsingHistoryByHistoryId(historyId);
    }
}
